import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;

public class ServletUsuCadastro extends HttpServlet {
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   	
  }

  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String nome = request.getParameter("nome");
    String email = request.getParameter("email");
	String login = request.getParameter("login");
    String senha = request.getParameter("senha");
	Usuario usu = new Usuario();
	usu.setNome(nome);
	usu.setEmail(email);
	usu.setLogin(login);
	usu.setSenha(senha);
	if (usu.incluirUsuario()){
		HttpSession session = request.getSession(true);
		session.setAttribute("cadastroSucesso",new String("true"));
		response.sendRedirect("usuCadastro.jsp");
	}else{
		response.sendRedirect("usuCadastro.jsp");
	}
		
  }
}